import axios from 'axios';

const request = axios.create({
  baseURL: process.env.VUE_APP_STS
});

request.interceptors.response.use(
  response => {
    const { data } = response;
    return data;
  },
  error => Promise.reject(error)
);

const getSTS = () => request.post('/base/appVideo/getSTSTempAuth');

const getPlayAuth = () => request.post('/base/appVideo/getVideoPlayAuth');

const getVideoInfo = videoId => {
  return request.get('/base/appVideo/getVideoInfo', { params: { videoId } });
};

export default { getSTS, getPlayAuth, getVideoInfo };
